/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.com.losalpes.marketplace.pitrack.entities.test;

import co.com.losalpes.marketplace.pitrack.entities.Track;
import co.com.losalpes.marketplace.pitrack.entities.persistence.Persistence;
import java.util.Random;

/**
 *
 * @author leon
 */
public class InicializarTrack {
    
    private static Random ranGen = new Random();
    private static Persistence persistence = new Persistence();
    private static String[] estados = {"Abierto", "Cerrado"};
    private static String[] fases = {"Abierto", "Cerrado"};
    private static String[] tipoTransaccion = {"RFQ", "RFB","CAL","POM"};
    private static String[] numSeguimiento = {"RFQ1377309784538", "RFQ1377309785815","RFQ1377309785992","RFQ1377309786948", "RFQ1377309787204","RFQ1377309788073","RFQ1377309789286",
                                              "RFQ1377309969208","POM1316473260265","POM1316469463859","POM1316473434265","POM1317930371613"};
    
    public static void main(String args[]) {
        
        for (int i = 0; i < 150; i++) {
            persistence.persist(obtenerTrack());
            
        }
    }
    
    public static Track obtenerTrack() {
        Track track = new Track();
        track.setIdTransaccion("TRACK" + System.currentTimeMillis());
        track.setEstado(estados[ranGen.nextInt(1)]);
        track.setFase(fases[ranGen.nextInt(1)]);
        track.setNitComercio(ranGen.nextInt(20) + "");
        track.setNitFabricante(ranGen.nextInt(20) + "");
        track.setNumSeguimiento(numSeguimiento[ranGen.nextInt(11)]);
        //track.setTiempo(ranGen.nextInt(10));
        track.setTipoTransaccion(tipoTransaccion[ranGen.nextInt(3)]);
        track.setUsuarioComercio(track.getNitComercio());
        track.setUsuarioFabricante(track.getNitFabricante());
        return track;
    }
}
